package com.ybkj.chat.module.friend_center.activity;

import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.Gravity;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.Switch;
import android.widget.TextView;

import com.ybkj.chat.R;
import com.ybkj.chat.base.BaseMvpActivity;
import com.ybkj.chat.manager.ActivityManager;
import com.ybkj.chat.ui.adapter.GroupMembersAdapter;
import com.ybkj.chat.ui.dialog.PpwClearChatRecord;
import com.youth.banner.Banner;

import butterknife.BindView;
import butterknife.OnClick;


/**
 * 群资料页8.33
 */
public class GroupDataActivity extends BaseMvpActivity {

    @BindView(R.id.rootview)
    RelativeLayout rootview;
    @BindView(R.id.bb_banner)
    Banner bbBanner;
    //群名
    @BindView(R.id.groupName)
    TextView groupName;
    @BindView(R.id.tag3)
    TextView tag3; //活跃
    @BindView(R.id.tag4)
    TextView tag4;  //vip
    @BindView(R.id.tag5)
    TextView tag5;  //公开
    //群号
    @BindView(R.id.groupnum)
    TextView groupnum;
    @BindView(R.id.tag1)
    TextView tag1;//车友
    @BindView(R.id.tag2)
    TextView tag2;//  86/200
    @BindView(R.id.distance)
    TextView distance; //距离
    //群介绍
    @BindView(R.id.group_introduce)
    TextView groupIntroduce;
    @BindView(R.id.ll_introduce)
    LinearLayout llIntroduce;
    //群成员数量
    @BindView(R.id.people_num)
    TextView peopleNum;
    @BindView(R.id.back)
    ImageView back;
    //群成员列表
    @BindView(R.id.xrc_people)
    RecyclerView xrcPeople;
    @BindView(R.id.ll_group_people)
    LinearLayout llGroupPeople;
    @BindView(R.id.group_notice)
    LinearLayout groupNotice;
    @BindView(R.id.group_manage)
    LinearLayout groupManage;
    @BindView(R.id.mygroup_name)
    LinearLayout mygroupName;
    @BindView(R.id.chat_record)
    LinearLayout chatRecord;
    //消息免打扰
    @BindView(R.id.swich)
    Switch swich;
    @BindView(R.id.chat_disturb)
    LinearLayout chatDisturb;
    @BindView(R.id.group_qrcode)
    LinearLayout groupQrcode;
    @BindView(R.id.empty_chat_records)
    LinearLayout emptyChatRecords;
    @BindView(R.id.btn_del)
    TextView btnDel;

    private GroupMembersAdapter mGroupMembersAdapter;
    private PpwClearChatRecord mPpwClearChatRecord;

    @Override
    protected void injectPresenter() {

    }

    @Override
    protected void initTitle() {

    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_groupdata;
    }

    @Override
    protected void initView() {
        initrecycle();
        initpop();
    }

    @Override
    protected void initData() {

    }


    @OnClick({R.id.ll_introduce, R.id.ll_group_people, R.id.group_notice, R.id.group_manage, R.id.mygroup_name, R.id.chat_record, R.id.chat_disturb,
            R.id.group_qrcode, R.id.empty_chat_records, R.id.btn_del, R.id.iv_back})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.ll_introduce://群介绍
                break;
            case R.id.ll_group_people://群成员
                break;
            case R.id.group_notice://群公告
                ActivityManager.gotoActivity(mContext, GroupNoticeActivity.class);
                break;
            case R.id.group_manage://群管理
                ActivityManager.gotoActivity(mContext, ManageGroupActivity.class);
                break;
            case R.id.mygroup_name://我的群名片
                ActivityManager.gotoActivity(mContext, EditMyGroupNameActivity.class);
                break;
            case R.id.chat_record://查看聊天记录
                ActivityManager.gotoActivity(mContext, ChatRecordActivity.class);
                break;
            case R.id.chat_disturb://消息免打扰
                break;
            case R.id.group_qrcode://查看群二维码
                ActivityManager.gotoActivity(mContext, GroupQRcodeActivity.class);
                break;
            case R.id.empty_chat_records://清空聊天记录
                mPpwClearChatRecord.showAtLocation(rootview, Gravity.BOTTOM, 0, 0);
                mPpwClearChatRecord.setBackgroundAlpha(this, 0.5f);
                break;
            case R.id.btn_del://删除并退出
                break;
            case R.id.iv_back://返回
                finish();
                break;
        }
    }

    private void initrecycle() {
        mGroupMembersAdapter = new GroupMembersAdapter(mContext);
        mGroupMembersAdapter.addData("1");
        mGroupMembersAdapter.addData("1");
        mGroupMembersAdapter.addData("1");
        mGroupMembersAdapter.addData("1");
        mGroupMembersAdapter.addData("1");
        mGroupMembersAdapter.addData("1");
        mGroupMembersAdapter.addData("1");
        mGroupMembersAdapter.addData("1");
        mGroupMembersAdapter.addData("1");
        mGroupMembersAdapter.addData("1");
        mGroupMembersAdapter.addData("1");
        mGroupMembersAdapter.addData("1");
        xrcPeople.setLayoutManager(new GridLayoutManager(mContext, 6));
        xrcPeople.setAdapter(mGroupMembersAdapter);
    }


    private void initpop() {
        mPpwClearChatRecord = new PpwClearChatRecord(mContext);
        mPpwClearChatRecord.setOnItemClickListener(new PpwClearChatRecord.OnItemClickListener() {
            @Override
            public void onItemClick(View v) {

                switch (v.getId()) {
                    case R.id.cancel:
                        mPpwClearChatRecord.dismiss();
                        break;
                    case R.id.confirm:
                        mPpwClearChatRecord.dismiss();
                        break;
                    case R.id.one_hour:
                        mPpwClearChatRecord.dismiss();
                        break;
                    case R.id.three_hour:
                        mPpwClearChatRecord.dismiss();
                        break;

                }
            }
        });
    }


}
